package com.ewzj.bigdata.mvp.ui.view

import android.content.Context
import android.support.v4.view.ViewPager
import android.util.AttributeSet
import android.view.MotionEvent

/**
 * author:zhangjing
 * 作用:
 * return:
 */

class UnSlidingViewPager : ViewPager {
    private var mDisableSroll = true

    constructor(context: Context) : super(context) {}

    constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {}

    fun setDisableScroll(bDisable: Boolean) {
        mDisableSroll = bDisable
    }

    override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
        if (mDisableSroll) {
            return false
        }
        return super.onInterceptTouchEvent(ev)
    }


    override fun onTouchEvent(ev: MotionEvent): Boolean {
        if (mDisableSroll) {
            return false
        }
        return super.onTouchEvent(ev)
    }

}
